package com.zj.config;

import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

@Component("categoryKeyGenerator")
public class CategoryKeyGenerator implements KeyGenerator {


    @Override
    public Object generate(Object target, Method method, Object... params) {
        Integer status = (Integer) params[0];
        return status != null && status != -1 ? "status:" + status : "all";
    }
}
